CFLAGS = -fpic -coverage -lm -std=c99

rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

playdom: dominion.o playdom.c
	gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)
	
testDrawCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

badTestDrawCard: badTestDrawCard.c dominion.o rngs.o
	gcc -o badTestDrawCard -g  badTestDrawCard.c dominion.o rngs.o $(CFLAGS)

testBuyCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)
testdominion: testdominion.c dominion.o rngs.o
	 gcc -o testdominion testdominion.c -g dominion.o rngs.o $(CFLAGS)

testdominion.out: testdominion
	        ./testdominion >> gameResults.out
		gcov dominion.c >> testdominion.out
		cat dominion.c.gcov >> testdominion.out

testAll: dominion.o testSuite.c
	gcc -o testSuite testSuite.c -g  dominion.o rngs.o $(CFLAGS)

interface.o: interface.h interface.c
	gcc -c interface.c -g  $(CFLAGS)

runtests: testDrawCard 
	./testDrawCard &> unittestresult.out
	gcov dominion.c >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out
unittest1: dominion.o rngs.o interface.o unittest1.c
	        gcc -o unittest1 -g unittest1.c dominion.o rngs.o interface.o $(CFLAGS)
		        
unittest2: dominion.o rngs.o interface.o unittest2.c
	        gcc -o unittest2 -g  unittest2.c dominion.o rngs.o interface.o $(CFLAGS)

unittest3: dominion.o rngs.o interface.o 
	        gcc -o unittest3 -g  unittest3.c dominion.o rngs.o $(CFLAGS)
		        
unittest4: dominion.o rngs.o interface.o 
	        gcc -o unittest4 -g  unittest4.c dominion.o rngs.o $(CFLAGS)
		        
cardtest1: dominion.o rngs.o interface.o 
	        gcc -o cardtest1 -g  cardtest1.c dominion.o rngs.o $(CFLAGS)
		        
cardtest2: dominion.o rngs.o interface.o 
	        gcc -o cardtest2 -g  cardtest2.c dominion.o rngs.o $(CFLAGS)

cardtest3: dominion.o rngs.o interface.o 
	        gcc -o cardtest3 -g  cardtest3.c dominion.o rngs.o $(CFLAGS)
		        
cardtest4: dominion.o rngs.o interface.o 
	        gcc -o cardtest4 -g  cardtest4.c dominion.o rngs.o $(CFLAGS)

unittestresults.out: dominion.o rngs.o interface.o 
	gcc -o unittest1 -g unittest1.c dominion.o rngs.o interface.o $(CFLAGS)
	gcc -o unittest2 -g unittest2.c dominion.o rngs.o interface.o $(CFLAGS)
	gcc -o unittest3 -g unittest3.c dominion.o rngs.o interface.o $(CFLAGS)
	gcc -o unittest4 -g unittest4.c dominion.o rngs.o interface.o $(CFLAGS)
	gcc -o cardtest1 -g  cardtest1.c dominion.o rngs.o $(CFLAGS)
	gcc -o cardtest2 -g  cardtest1.c dominion.o rngs.o $(CFLAGS)
	gcc -o cardtest3 -g  cardtest1.c dominion.o rngs.o $(CFLAGS)
	gcc -o cardtest4 -g  cardtest1.c dominion.o rngs.o $(CFLAGS)

	 ./unittest1 &> unittestsresults.out
	 gcov dominion.c >> unittestresults.out
	 cat dominion.c.gcov >> unittestresult.out
	 
	 ./unittest2 >> unittestsresults.out
	 gcov dominion.c >> unittestresults.out
	  cat dominion.c.gcov >> unittestresult.out

	 ./unittest3 >> unittestresult.out
	 gcov dominion.c >> unittestresults.out
	 cat dominion.c.gcov >> unittestresult.out

	 ./unittest4 >> unittestresult.out
	 gcov dominion.c >> unittestresults.out

	 ./cardtest1 &>> unittestresults.out
	 gcov dominion.c >> unittestresults.out
	 cat dominion.c.gcov >> unittestresult.out

	 ./cardtest2 >> unittestresults.out
	 gcov dominion.c >> unittestersults.out
	 cat dominion.c.gcov >> unittestresult.out

	 ./cardtest3 >> unittestresults.out
	 gcov dominion.c >> unittestersults.out
	 cat dominion.c.gcov >> unittestresult.out


	 ./cardtest4 >> unittestersults.out
	 gcov dominion.c >> unittestresults.out
	 cat dominion.c.gcov >> unittestresult.out

randomtestadventurer: randomtestadventurer.c dominion.o rngs.o
	gcc -g -o randomtestadventurer randomtestadventurer.c dominion.o rngs.o $(CFLAGS)

randomtestcard: randomtestcard.c dominion.o rngs.o
	gcc -g -o randomtestcard randtestcard.c dominion.o rngs.o $(CFLAGS)

rtc: randomtestadventurer randomtestcard
	./randomtestadventurer &> randomtestadventurer.out
	gcov dominion.c >> randomtestadventurer.out
	cat dominion.c.gcov >> randomtestadventurer.out
	./randomtestcard &> randomtestcard.out
	gcov dominion.c >> randomtestcard.out
	cat dominion.c.gcov >> randomtestcard.out
tarantula: tarantula.c 
	gcc -o tarantula -g tarantula.c
tarantulaOutput: tarantulaOut.out
	./tarantula >> tarantulaOut.out	
	gcov dominion.c >> unittestresults.out
	





player: player.c interface.o
	gcc -o player player.c -g  dominion.o rngs.o interface.o $(CFLAGS)

all: playdom player testDrawCard testBuyCard badTestDrawCard unittest1 unittest2 unittest3 unittest4 cardtest1 cardtest2 cardtest3 cardtest4 randomtestadventurer randomtestcard testdominion testdominion.out gameResults.out

clean:
	rm -f *.o playdom.exe playdom test.exe test player player.exe testInit testInit.exe *.gcov *.gcda *.gcno *.so unittest1 unittest2 unittest3 unittest4 cardtest1 cardtest2 cardtest3 cardtest4 randomtestadventurer randomtestcard testdominion tarantula tarantulaOutput
